/*
XCommander Extension
http://www.xcommander.ch/
*/

function XCommanderStorage() {
}

XCommanderStorage.prototype = {
	getItem : function(key) {
		return localStorage.getItem(key);
	},
	getJSONItem : function (key) {
	  	var value = localStorage.getItem(key);
		if( typeof value != 'undefined') {
			return JSON.parse(value);
		} else {
			return null;
		}
	},
	setItem : function(key, value) {
		return localStorage.setItem(key, value);
	},
	setJSONItem : function(key, value) {
		return localStorage.setItem(key, JSON.stringify(value));
	},
	removeItem : function(key) {
		return localStorage.removeItem(key);
	},
	clear : function() {
		return localStorage.clear();
	},
	getKeys : function() {
		var keys = [];
		for(var i = 0; i < localStorage.length; i++) {
			keys.push(localStorage.key(i));
		}
		return keys;
	}
};

